import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
export default new Vuex.Store({
    state: {
        navflag: true, //控制脚步栏显示的state
        activeIndex: localStorage.activeIndex ? localStorage.activeIndex : 0, //脚步栏激活下标
    },
    mutations: {
        changeNav(state, flag) {
            state.navflag = flag;
        },
        changeIndex(state, index) {
            state.activeIndex = index;
            localStorage.activeIndex = index;
        }
    },
    actions: {
        navActions({ commit }, flag) {
            commit("changeNav", flag)
        },
        indexActions({ commit }, index) {
            commit("changeIndex", index)
        }
    },
    modules: {}
})